Amber asks, “I figured out how to make my YouTube video play automatically, is there a way to make it keep playing over and over again without having to press the play button?”

YouTube enables a number of parameters by appending data to the URL of the video file. They do a lousy job of making the information easy to find, but once you know how it works implementation is fairly easy. I recently stepped through how to automatically start a YouTube video. To make the video loop, so that it automatically repeats when it reaches the end, you need to add a slightly different command either in addition to the autostart feature or by itself if you want viewers to click play the first time.

Lots of web content management systems, like WordPress, make it easy to paste a link to a YouTube video into a page and have the video automatically show up. This feature is great if you want all the default settings of a YouTube video embed. If you want to customize the way your video plays back, you need to use a Custom HTML block in WordPress instead. Other content platforms have similar solutions.

First grab the embed code from YouTube and paste it into the page where you want to customize it.

YouTube embed code in an iframe after copying into a WordPress Custom HTML content block.

One key thing to note is that YouTube exposes features like autoplay and looping as features of a playlist, so the first step in setting up a video to loop is converting the embed code provided by YouTube from a video embed to a playlist embed.

In the screen above you can see that the video URL is listed as: src="https://www.youtube.com/embed/_aOQSN_Ahmo"

To make the video autoplay you need to change this from a video embed to a playlist embed like this:

src="https://www.youtube.com/embed?playlist=_aOQSN_Ahmo"

Next you need to make a modification to the embed URL to enable automatically repeating your YouTube video like this:

src="https://www.youtube.com/embed?playlist=_aOQSN_Ahmo&loop=1"

The finished iFrame will look like the one in the screenshot below.

Screenshot of a WordPress Custom HTML block with a YouTube embed code modified to allow the video to automatically repeat when it reaches the end.

Image Credit: Some featured images on this site are stock images purchased from Depositphotos.

Trending

Discover more from Jake Ludington

Subscribe now to keep reading and get access to the full archive.

Continue reading

Discover more from Jake Ludington

Subscribe now to keep reading and get access to the full archive.

Continue reading